package com.fcml.pattern.observer.observer;

/**
 * @author fcml
 * @date 2018/11/3
 *
 * 具体的观察者
 */
public class User implements Observer {
    private String username;
    private String message;

    public User(String username) {
        this.username = username;
    }


    @Override
    public void notify(String message) {
        this.message = message;
        readMessage();
    }

    private void readMessage() {
        System.out.println(username + " 收到消息：" + message);
    }
}
